﻿//25.Write a program that extracts from given HTML file its title (if available), and its body text without the HTML tags. Example:

using System;
using System.Text;

namespace HTMLBody
{
    class HTMLBody
    {
        static void Main()
        {
            string html = "<html><head><title>News</title></head> <body><p><a href=\"http://academy.telerik.com\"> Telerik " +
                        "Academy</a> aims to provide free real-world practical training for young people who want to turn into " +
                        "skillful .NET software engineers.</p></body></html>";

            StringBuilder plain = new StringBuilder(html);

            int open = plain.ToString().IndexOf('<');
            int close = 0;
            while (open != -1)
            {
                close = plain.ToString().IndexOf('>');
                plain = plain.Replace(plain.ToString().Substring(open, close - open + 1), "");
                open = plain.ToString().IndexOf('<');
            }
            Console.WriteLine();
            Console.WriteLine(plain);
        }
    }
}
